﻿using System;

public class TestPayCtrl : IPayCtrl
{
    public PayType payType => PayType.EDITOR;

    public bool initialized => throw new NotImplementedException();

    public void CheckDropOrder()
    {
        GameDebug.Log("TestPayCtrl -> CheckDropOrder");
    }

    public void InitIAP(Action onEnd)
    {
        GameDebug.Log("TestPayCtrl -> InitIAP");
        onEnd?.Invoke();
    }

    public void Pay(GoodsArche goods, Action<string> onPayFail, Action<string, PaymentValidateResponseData> onValidateResult)
    {
        PaymentValidateData paymentValidateData = new PaymentValidateData();
        paymentValidateData.payType = (int)this.payType;
        paymentValidateData.goodsId = goods.goodsId;
        RequestServerController.instance.ReqPayment(paymentValidateData, onPayFail, (response) =>
        {
            if (response != null)
            { 
                onValidateResult?.Invoke(goods.goodsId, response);
            }
            else
            {
                onPayFail?.Invoke("payment fail!");
            }
        });
    }
}


